package com.ltmall.api.controller;

import com.ltmall.api.bean.DirectorPrivilegePackage;
import com.ltmall.api.manager.DirectorPrivilegePackageManager;
import com.ltmall.api.util.RemoteUtil;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class DirectorPrivilegePackageController {

    private DirectorPrivilegePackageManager directorPrivilegePackageManager;

    public void listAllPackages(HttpServletRequest request, HttpServletResponse response) {
        List<DirectorPrivilegePackage> packagesList = directorPrivilegePackageManager.listAllPackage();
        if (packagesList == null) {
            RemoteUtil.response(response, null, -1, "返回失败");
        } else {
            RemoteUtil.response(response, packagesList, 1, "返回成功");
        }
    }

    public DirectorPrivilegePackageManager getDirectorPrivilegePackageManager() {
        return directorPrivilegePackageManager;
    }

    public void setDirectorPrivilegePackageManager(DirectorPrivilegePackageManager directorPrivilegePackageManager) {
        this.directorPrivilegePackageManager = directorPrivilegePackageManager;
    }
}
